﻿using ChurchDiary.BLL;
using ChurchDiary.Common;
using ChurchDiary.TableEntity;
using ChurchWebsite.Controllers;
using CrystalDecisions.CrystalReports.Engine;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace ChurchWebsite.Areas.Church.Controllers
{
    public class BaptismController : BaseController
    {
        //
        // GET: /Church/Baptism/

        public ActionResult Index()
        {
            return View();
        }
       /* public ActionResult PrintBaptism(Guid BaptismId)
        {
            ReportDocument rd = new ReportDocument();
            rd.Load(Path.Combine(Server.MapPath("~/Reports"), "RptPrintBaptism.rpt"));
            rd.SetDataSource(new BLL_Member().GetBaptismDetailsforPrint(BaptismId));

            Response.Buffer = false;
            Response.ClearContent();
            Response.ClearHeaders();
            try
            {
                Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                stream.Seek(0, SeekOrigin.Begin);
                return File(stream, "application/pdf");
            }
            catch (Exception ex)
            {
                throw;
            }
        }


        public ActionResult AddBaptism(EntityBaptism Baptism)
        {
            return Json(new BLL_Member().AddBaptism(Baptism),JsonRequestBehavior.AllowGet);
        }
        public ActionResult UpdateBaptism(EntityBaptism Baptism)
        {
            return Json(new BLL_Member().UpdateBaptism(Baptism), JsonRequestBehavior.AllowGet);
        }
        public ActionResult DeleteBaptism(Guid dataId)
        {
            return Json(new BLL_Member().DeleteBaptism(dataId), JsonRequestBehavior.AllowGet);
        }
        public ActionResult GetBaptism(Guid dataId)
        {
            return Json(new BLL_Member().GetBaptism(dataId), JsonRequestBehavior.AllowGet);
        }
        public ActionResult GetBaptisms()
        {
            return Json(new BLL_Member().GetBaptism(), JsonRequestBehavior.AllowGet);
        }
        public JsonResult GetMembersDetails(Guid MemberId)
        {
            return Json(new BLL_Member().GetFamilyMemberFulldetails(MemberId),JsonRequestBehavior.AllowGet);
        }
        public JsonResult GetMembers()
        {
            return Json(new BLL_Member().GetFamiliesWithMembers(), JsonRequestBehavior.AllowGet);
        }

        public JsonResult GetSearchMembers(string SearchKey)
        {
            if (!string.IsNullOrEmpty(SearchKey))
            {
                return Json(new BLL_Member().GetFamiliesWithMembersSearch(SearchKey), JsonRequestBehavior.AllowGet);
            }
            else
            {
                return Json(new BLL_Member().GetFamiliesWithMembers(), JsonRequestBehavior.AllowGet);
            }
        }
        */
    }
}
